package com.hengxinguotong.zhihuichengjian.weekpicker.entity;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

public class MonthHelper {

    /**
     * 获取所有年份
     * @return List<Integer>
     */
    public static List<Integer> getYears() {
        List<Integer> yearList = new ArrayList<>();
        int currentYear = Calendar.getInstance().get(Calendar.YEAR);
        // 添加上下100年
        for(int i = (currentYear - 100);i <= (currentYear + 100) ; i++){
            yearList.add(i);
        }
        return yearList;
    }

    /**
     * 获取所有月份
     * @return List<Integer>
     */
    public static List<Integer> getMonths() {
        List<Integer> monthList = new ArrayList<>();
        int currentYear = Calendar.getInstance().get(Calendar.YEAR);
        // 添加12个月
        for(int i = 1;i <= 12; i++){
            monthList.add(i);
        }
        return monthList;
    }

    /**
     * 获取当前月份
     * @return int
     */
    public static int getSelectMonth(){
        return Calendar.getInstance().get(Calendar.MONTH);
    }

}